package com.six.epidemic.report.mapper

import com.baomidou.mybatisplus.core.mapper.BaseMapper
import com.six.epidemic.report.pojo.EpidemicReport
import com.six.epidemic.report.pojo.vo.SearchEpidemicReport
import org.apache.ibatis.annotations.Mapper
import org.apache.ibatis.annotations.Param
import org.apache.ibatis.annotations.Select

@Mapper
interface EpidemicReportMapper : BaseMapper<EpidemicReport> {
    @Select(
        "<script>" +
                "select * from epidemicReport " +
                "<where>" +
                "<if test='model.province != null'>" +
                " and provinces like CONCAT('%',#{model.province},'%') " +
                "</if>" +
                "<if test='model.city != null'>" +
                " and provinces like CONCAT('%',#{model.city},'%') " +
                "</if>" +
                "<if test='model.district != null'>" +
                " and provinces like CONCAT('%',#{model.district},'%') " +
                "</if>" +
                "<if test='model.startTime != null and model.endTime != null'>" +
                " and reporttime between #{model.startTime} and #{model.endTime}" +
                "</if>" +
                "</where>" +
                "order by id desc " +
                "</script>"
    )
    fun getPageListByQuery(@Param("model") model: SearchEpidemicReport): List<EpidemicReport>

    @Select("SELECT * FROM FlowerManage.epidemicReport  ")
    fun findAll(): List<EpidemicReport>
}